<?php

include './functions.php';
include './Db.php';

if(!isset($_SESSION['user_id'])){
	exit(json_encode(['error'=>1,'msg'=>'还没有登录，请先登录！']));
}

$data = $_POST;

$data['create_time'] =time();

$data['uid'] = $_SESSION['user_id'];

$db = new Db('msg');

$res = $db->save($data);

if($res){
	exit(json_encode(['error'=>0,'msg'=>'发布成功']));
}else{
	exit(json_encode(['error'=>1,'msg'=>'发布失败']));
}

